﻿using System.ComponentModel.Composition;
using Fisharoo.Common;
using Fisharoo.Interfaces;
using Fisharoo.Web.Account.Interfaces;

namespace Fisharoo.Web.Account.Presenters
{
    public class LoginPresenter
    {
        private ILogin _view;
        [Import]
        private IAccountService _accountService;
        [Import]
        private IRedirector _redirector;

        public void Init(ILogin view)
        {
            _view = view;
            MEFManager.Compose(this);
        }

        public void Login(string username, string password)
        {
            string message = _accountService.Login(username, password);
            _view.DisplayMessage(message);
        }

        public void GoToRegister()
        {
            _redirector.GoToAccountRegisterPage();
        }

        public void GoToRecoverPassword()
        {
            _redirector.GoToAccountRecoverPasswordPage();
        }
    }
}
